import React, { Component } from 'react';
import {Link} from 'react-router-dom'
class Index extends Component {
    render() {
        const MovieItem = this.props.data.map(item => {
            return (
                <Link to={`/movieDetail?id=${item._id}`}>
                    <div key={item.id} className='content'>
                        <img src={item.pic} alt="" />
                        <div>{item.title}</div>
                    </div>
                </Link>
            )
        })
        return (
            <div className='container'>
                {MovieItem}
            </div>
        );
    }
    
}

export default Index;
